<template>
<view>	
	<view class="issue_bg" v-if="showissue"></view>
	<view class="issue_items" v-if="showissue">
		<view class="item"  @click="goToPage(1)" >
			<image class="icon" mode="aspectFill" src="https://oa.yuxiang123.cn/uploads/xcx_img/home21.svg"></image>
			<view class="fabu_1">
				<view class="fabu_2">发帖任务</view>
				<view class="fabu_3">录入标题内容进行发布</view>
			</view>
		</view>
		<view class="item"  @click="goToPage(2)" style="background-color: #d34bea;">
			<image class="icon" mode="aspectFill" src="https://oa.yuxiang123.cn/uploads/xcx_img/home20.svg"></image>
			<view class="fabu_1">
				<view class="fabu_2">评论任务</view>
				<view class="fabu_3">录入标题内容进行发布</view>
			</view>
		</view>
		<!--<view class="item"  @click="goToPage(1)">
			<image class="icon" mode="aspectFill" src="https://oa.yuxiang123.cn/uploads/xcx_img/home21.svg"></image>
			<view class="fabu_1">
				<view class="fabu_2">发布闲置</view>
				<view class="fabu_3">让你的闲置循环起来</view>
			</view>
		</view>
		<view class="item" @click="goToPage(2)" style="background-color: #d34bea;">
			<image class="icon" mode="aspectFill" src="https://oa.yuxiang123.cn/uploads/xcx_img/home22.png"></image>
			<view class="fabu_1">
				<view class="fabu_2">发布动态</view>
				<view class="fabu_3">分享自己的日常生活</view>
			</view>
		</view>
		<view class="item" @click="goToPage(0)" style="background-color: #FD6478;">
			<image class="icon" mode="aspectFill" src="https://oa.yuxiang123.cn/uploads/xcx_img/home20.svg"></image>
			<view class="fabu_1">
				<view class="fabu_2">发布心愿</view>
				<view class="fabu_3">许下你的的美好愿望</view>
			</view>
		</view> -->
		<image class="fabu_close" src="@/static/close.png" @click="hideissue()"></image>
	</view>
	<view class="tabbar bai" :class="isHuaWei?'isHuaWei_':''">
		<view class="item" v-for="(item,index) in list" :key="index" @click="go(item.url,index)">
			<view v-if="item.text == 1" class="fabu"><view class="fabu_text" >发布</view></view>
			<view v-else>
				<image v-if="type == index" :src="item.img2" class="img" ></image>
				<image v-else :src="item.img1" class="img" ></image>
				<view class="text"  :class="type == index ? 'selectText':''" >{{item.text}}</view>
			</view>
			 
		</view>
	</view>
</view>
</template>
<script>
	export default {
		name:"tabbar",
		data() {
			return {
				list:[
					{text:'首页',url:'/pages/shop/shopClass',img1:'https://oa.yuxiang123.cn/assets/task/shop/home1.png',img2:'https://oa.yuxiang123.cn/assets/task/shop/home1_.png'},
					{text:'任务',url:'/pages/task/taskList',img1:'https://oa.yuxiang123.cn/assets/task/shop/home2.png',img2:'https://oa.yuxiang123.cn/assets/task/shop/home2_.png'},
					{text:'1',url:'/merchant/issue/add',img1:'',img2:''},
					{text:'订单',url:'/pages/order/orderList',img1:'https://oa.yuxiang123.cn/assets/task/shop/home3.png',img2:'https://oa.yuxiang123.cn/assets/task/shop/home3_.png'},
					{text:'我的',url:'/pages/user/user',img1:'https://oa.yuxiang123.cn/assets/task/shop/home4.png',img2:'https://oa.yuxiang123.cn/assets/task/shop/home4_.png'}
				],
				popup:false,
				num:0,
				deviceBrand_list:[],
				bili:0,
				bili_2:0,
				userInfo:''
			};
		},
		props:['type','showissue'],
		created() {
			this.$emit('showissue',false);
			//判断是否是华为
			let isHuaWei= getApp().globalData.isHuaWei;
			this.setData({
				isHuaWei: isHuaWei
			})
			this.userInfo = uni.getStorageSync('userInfo');
		},
		methods:{
			go:function(url,index){
				if(index==2){
					this.$emit('closeissue',false);
					this.userInfo = uni.getStorageSync('userInfo');
					if(!this.userInfo){
						var url='/subone/public/login';
						uni.navigateTo({
							url:url,
							animationType:'slide-in-bottom',
							animationDuration: 300
						})
					}else if(!this.userInfo.shop){
						if(this.userInfo.shop_status == 0){
							this.$Toast('审核已提交,请等待审核');
							return false;
						}else  if(this.userInfo.shop_status == -2){
							this.$Toast('您已被冻结,请联系客服');
							return false;
						}else{
							url='/merchant/shop/add_shop';
						}
						uni.navigateTo({
							url:url,
							animationType:'slide-in-bottom',
							animationDuration: 300
						})
					}else{
						uni.navigateTo({
							url:'/merchant/issue/add'
						});
					}

					

					// this.$emit('openissue',true);
					// this.userInfo = uni.getStorageSync('userInfo');
					// if(!this.userInfo){
					// 	var url='/subone/public/login';
					// 	uni.navigateTo({
					// 		url:url,
					// 		animationType:'slide-in-bottom',
					// 		animationDuration: 300
					// 	})
					// }else if(!this.userInfo.shop){
					// 	if(this.userInfo.shop_status == 0){
					// 		this.$Toast('审核已提交,请等待审核');
					// 		return false;
					// 	}else  if(this.userInfo.shop_status == -2){
					// 		this.$Toast('您已被冻结,请联系客服');
					// 		return false;
					// 	}else{
					// 		url='/merchant/shop/add_shop';
					// 	}
					// 	uni.navigateTo({
					// 		url:url,
					// 		animationType:'slide-in-bottom',
					// 		animationDuration: 300
					// 	})
					// }
					
					// uni.navigateTo({
					// 	url:url
					// });
				}else{
					this.$emit('closeissue',false);
					uni.switchTab({
						url:url
					});
				}
			},
			hideissue(){
				this.$emit('closeissue',false);		
			},
			goToPage(type){
				this.$emit('closeissue',false);	
				this.userInfo = uni.getStorageSync('userInfo');
				if(!this.userInfo){
					var url='/subone/public/login';
					uni.navigateTo({
						url:url,
						animationType:'slide-in-bottom',
						animationDuration: 300
					})
				}else if(!this.userInfo.shop){
					if(this.userInfo.shop_status == 0){
						this.$Toast('审核已提交,请等待审核');
						return false;
					}else  if(this.userInfo.shop_status == -2){
						this.$Toast('您已被冻结,请联系客服');
						return false;
					}else{
						url='/merchant/shop/add_shop';
					}
					uni.navigateTo({
						url:url,
						animationType:'slide-in-bottom',
						animationDuration: 300
					})
					return false;
				}else if(this.userInfo.shop && !this.userInfo.shop.balance  && !this.userInfo.shop.enemy_num  && !this.userInfo.shop.thirdpartnar_num && !this.userInfo.shop.monthly_num){
					//跳转充值页面
					uni.navigateTo({
						url:'/merchant/shop/meal',
						animationType:'slide-in-bottom',
						animationDuration: 300
					})
					return false;
				}	
				if(type==1){
					uni.navigateTo({
						url:'/merchant/issue/add?type=1'
					});
					return false;
				}else if(type==2){
					uni.navigateTo({
						url:'/merchant/issue/add?type=2'
					});
					return false;
				}
			},
		}
	}
</script>

<style lang="scss">
.isHuaWei_{
	padding-bottom: 50rpx !important;
}
// #ifdef MP-WEIXIN
.fabu{
	width: 115rpx;
	height: 115rpx;
	background: #31D1C9;
	border-radius: 50%;
	color: #fff;
	margin-top: -40rpx;
	border: 8rpx solid #fff;
	font-size: 26rpx;
	font-weight: 600;
	margin-left: 12rpx;
	.fabu_text{
		width: 80%;
		margin-left: 10%;
		line-height: 36rpx;
		margin-top: 39rpx;
		font-size: 33rpx;
	}
}
// #endif
// #ifdef APP-PLUS  || H5
.fabu{
		width: 135rpx;
		height: 135rpx;
		background: #FFEB3B;
		border-radius: 50%;
		margin-top: -40rpx;
		border: 8rpx solid #fff;
		font-size: 26rpx;
		font-weight: 600;
		margin-left: 12rpx;
		
	}
	.fabu_text{
			width: 60%;
			margin-left: 20%;
			line-height: 36rpx;
			margin-top: 24rpx;
		}
// #endif

.issue_bg{width:100%;height:100%;position: fixed;top:0;left:0; z-index: 10000;background-color: #000;opacity:0.8;}
.issue_items{
	width:66%;
	position:fixed;
	left:17%;
	bottom:100upx;
	z-index:10001;
	text-align: center;
	margin-bottom: 0rpx;
}
.issue_items .item{
	background: #FE9A3E;
    padding: 15upx;
    border-radius: 15upx;

	color:#fff;
	display:flex;
	justify-content: center;
	flex-direction: row;
	margin-bottom:40upx;
}
.issue_items .item .icon{width:120rpx;height:120rpx; border-radius: 50%;float:left;    margin-left: -90rpx;
    margin-top: -10rpx;}
.issue_items .item .fabu_1{padding-left: 20rpx;}
.issue_items .item .fabu_1 .fabu_2{height:70rpx;line-height:70rpx;font-size: 36rpx;text-align: left;}
.issue_items .item .fabu_1 .fabu_3{height:50rpx;line-height:50rpx;font-size: 28rpx;text-align: left;opacity: 0.7;}

.issue_items .fabu_close{width:64rpx;height:64rpx; margin:10rpx 0 120rpx 0;;}

.tabbar.hei{
	background-color: #333333;
	.item{
		.text{color:#fff;}
	}
}
.tabbar.bai{
	background-color: #fff;
	border-top: 1rpx solid #ddd;
	.item{
		.text{color:#333}
	}
}
.tabbar{
	padding-bottom: 20rpx;
	position: fixed;
	bottom:0px;
	width: 100%;
	z-index: 999990;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
	align-items: center;
	.item{
		width:20%;
		height:116rpx;		
		line-height: 100rpx;
		text-align: center;
		.img{
			width:56upx;
			height:56upx;
			margin-top:16upx;
		}
		.text{
			font-size:22upx;
			color: #ffffff;
			opacity: 0.4;
			margin-top: -72upx;
		}
		.selectText{
			opacity:1;
		}
	}
}


.popup{
	position: fixed;
	width: 100%;
	top:40%;
	display: flex;
	align-items: center;
	justify-content:center;
	z-index: 333333;
	.popup_box{
		background-color: #FFFFFF;
		width: 90%;
		padding: 30upx 0;
		text-align: center;
		border-radius: 20upx;
		.popup_box_title{
			padding:0 40rpx;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			.popup_title{height:60rpx;line-height: 60rpx;text-align: center;width:100%;}
			.close{width:60rpx;height:60rpx;}
		}
		.popup_box_img{			
			width: 200upx;
			height: 200upx;
			margin:30upx auto;
		}
		.popup_box_text{
			padding: 0 40upx;
		}
	}
}
</style>
